import java.util.Scanner;

public class TestF {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a, b, c;
        String t;
        while (sc.hasNext()) {
            t = sc.next();
            String[] sourceArray = t.split("/", 3);
            a = Integer.parseInt(sourceArray[0]);
            b = Integer.parseInt(sourceArray[1]);
            c = Integer.parseInt(sourceArray[2]);
            if ((a % 4 == 0 && a % 100 != 0) || a % 400 == 0) {
                switch (b) {
                    case 12:
                        c += 31;
                    case 11:
                        c += 30;
                    case 10:
                        c += 31;
                    case 9:
                        c += 30;
                    case 8:
                        c += 31;
                    case 7:
                        c += 31;
                    case 6:
                        c += 30;
                    case 5:
                        c += 31;
                    case 4:
                        c += 30;
                    case 3:
                        c += 31;
                    case 2:
                        c += 29;
                    case 1:
                        c = c;
                }
            } else {
                switch (b) {
                    case 12:
                        c += 31;
                    case 11:
                        c += 30;
                    case 10:
                        c += 31;
                    case 9:
                        c += 30;
                    case 8:
                        c += 31;
                    case 7:
                        c += 31;
                    case 6:
                        c += 30;
                    case 5:
                        c += 31;
                    case 4:
                        c += 30;
                    case 3:
                        c += 31;
                    case 2:
                        c += 28;
                    case 1:
                        c = c;
                }
            }
            System.out.printf("%d", c);
            System.out.println();
        }

    }

}
